﻿using System;

namespace Work3
{
    public delegate bool GradePrint(Student s);
    public class Student
    {
        public Student(string name, int sno, int chinese, int mathematics, int english)
        {
            this.Name = name;
            this.Sno = sno;
            this.Chinese = chinese;
            this.Mathematics = mathematics;
            this.English = english;
        }
        public string Name { get; set; }
        public int Sno { get; set; }
        public int Chinese { get; set; }
        public int Mathematics { get; set; }
        public int English { get; set; }
        public GradePrint GP { set; get; } = GradeReport.GradeReportOrderByTerm;
    }
    public class GradeReport
    {
        public static bool GradeReportOrderByTerm(Student s)
        {
            try
            {
                Console.WriteLine("学生姓名：" + s.Name);
                Console.WriteLine("学生学号：" + s.Sno);
                Console.WriteLine("语文成绩：" + s.Chinese);
                Console.WriteLine("数学成绩：" + s.Mathematics);
                Console.WriteLine("英语成绩：" + s.English);
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
    class Program
    {
        public static void Main(string[] args)
        {
            Student student = new Student("小白", 20227, 99, 98, 97);
            if (student.GP(student))
            {
                Console.WriteLine("成绩单打印成功！");
            }
            else
            {
                Console.WriteLine("成绩单打印失败！");
            }
            Console.ReadLine();
        }
    }
}
